package com.iot.api;

import java.util.Map;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;

import com.google.common.collect.Maps;
import com.iot.service.DataDockingService;

@RestController
@RequestMapping(value = "/sys/0")
public class DataDockingApi {
	private static final Logger logger = LoggerFactory.getLogger(DataDockingApi.class);
	
	@Autowired
	private DataDockingService dataDockingService;
	
	@RequestMapping(value = "getDevInfo", method = RequestMethod.POST)
	public Map<String, Object> getDevInfo() {
		Map<String, Object> resultMap = Maps.newHashMap();
		try {
			resultMap.put("code", "0");
			resultMap.put("message", "获取设备信息成功");
			resultMap.put("data", dataDockingService.getDevInfo());
		} catch (Exception e) {
			resultMap.put("code", "0");
			resultMap.put("message", "获取设备信息异常");
			resultMap.put("data", null);
			
			logger.error("获取设备信息异常", e);
		}
		return resultMap;
	}
}